home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / syscall / RCS / Fs_Truncate.c,v < prev    next >
Encoding:
Text File  |  1991-12-09  |  2.0 KB  |  98 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     88.06.19.14.29.13;  author ouster;  state Exp;
  11. branches 1.1.1.1;
  12. next     ;
  13.  
  14. 1.1.1.1
  15. date     91.12.08.17.05.29;  author kupfer;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24.  
  25. 1.1
  26. log
  27. @Initial revision
  28. @
  29. text
  30. @/* 
  31.  * Fs_Truncate.c --
  32.  *
  33.  *    Source code for the Fs_Truncate library procedure.
  34.  *
  35.  * Copyright 1988 Regents of the University of California
  36.  * Permission to use, copy, modify, and distribute this
  37.  * software and its documentation for any purpose and without
  38.  * fee is hereby granted, provided that the above copyright
  39.  * notice appear in all copies.  The University of California
  40.  * makes no representations about the suitability of this
  41.  * software for any purpose.  It is provided "as is" without
  42.  * express or implied warranty.
  43.  */
  44.  
  45. #ifndef lint
  46. static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
  47. #endif not lint
  48.  
  49. #include <sprite.h>
  50. #include <fs.h>
  51.  
  52.  
  53. /*
  54.  *----------------------------------------------------------------------
  55.  *
  56.  * Fs_Truncate --
  57.  *
  58.  *    Truncate a file to a given length, given its name.  This maps the
  59.  *    operation into an Fs_Open, Fs_IOControl, and then closes the file.
  60.  *
  61.  * Results:
  62.  *    Result from Fs_IOControl.
  63.  *
  64.  * Side effects:
  65.  *    Shorten the file to length bytes.
  66.  *
  67.  *----------------------------------------------------------------------
  68.  */
  69.  
  70. ReturnStatus
  71. Fs_Truncate(pathName, length)
  72.     char *pathName;        /* Name of the file to truncate */
  73.     int     length;        /* The size to truncate to */
  74. {
  75.     ReturnStatus status;
  76.     int streamID;
  77.  
  78.     status = Fs_Open(pathName, FS_WRITE, 0, &streamID);
  79.     if (status != SUCCESS) {
  80.     return(status);
  81.     }
  82.     status = Ioc_Truncate(streamID, length);
  83.     (void) Fs_Close(streamID);
  84.     return(status);
  85. }
  86. @
  87.  
  88.  
  89. 1.1.1.1
  90. log
  91. @Initial branch for Sprite server.
  92. @
  93. text
  94. @d17 1
  95. a17 1
  96. static char rcsid[] = "$Header: /sprite/src/lib/c/syscall/RCS/Fs_Truncate.c,v 1.1 88/06/19 14:29:13 ouster Exp $ SPRITE (Berkeley)";
  97. @
  98.